import request from '@/utils/request'
export function fetchList(params) {
  return request({
    url:'/admin/list',
    method:'get',
    params:params
  })
}
export function userRoles(params) {
  console.log('paramsparams',params)
  return request({
    url:'/admin/role/'+params,
    method:'get',
  })
}
// export function userRoleCheck(params) {
//   return request({
//     url:'/sys/sysUser/userRoleCheck',
//     params:params,
//     method:'get',
//   })
// }



export function checkPermission(params) {
  return request({
    url:'/admin/checkRole/' + params,
    method:'get',
  })
}
// GET /admin/role/{adminId}
export function createAdmin(data) {
  console.log('dasdsadsa',data)
  return request({
    url:'/admin/register',
    method:'post',
    data:data
  })
}
export function updateShowStatus(data) {
  return request({
    url:'/admin/update/showStatus',
    method:'post',
    data:data
  })
}

export function updateFactoryStatus(data) {
  return request({
    url:'/admin/update/factoryStatus',
    method:'post',
    data:data
  })
}

export function deleteAdmin(data) {
  let dataList = data.join(',')
  return request({
    url:'/admin/delete?ids=' + dataList,
    method:'post',
  })
}

// export function deleteUser(data) {
//   let dataList = data.join(',')
//   return request({
//     url:'/admin/delete?ids=' + dataList,
//     method:'post'
//   })
// }

export function getAdmin(id) {
  return request({
    url:'/admin/'+id,
    method:'get',
  })
}

export function getAdminPermission(id) {
  return request({
    url:'/admin/permission',
    method:'get',
  })
}



export function updateAdmin(id,data) {
  return request({
    url:'/admin/update/'+id,
    method:'post',
    data:data
  })
}

export function updateAdminRole(data) {
  return request({
    url:'/admin/role/update?roleIds=' + data.roleIds + '&' + 'adminId=' + data.adminId,
    method:'post',
    data:data
  })
}

// /admin/role/update?adminId=13&roleIds=7

